# -*- coding: utf-8 -*-
# @Time    : 2023/6/5 14:10
# @Author  : hyh
# @Email   : 935887145@qq.com
# @File    : share_works_page.py
# @Software: PyCharm
from pages.base_page import BasePage
from appium import webdriver
from tools import driver
from appium.webdriver.common.mobileby import MobileBy as By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import  expected_conditions as EC

class ShareWorksPage(BasePage):
    picture_locator = (By.XPATH,'//*[@resource-id="com.xiachufang:id/rv_course_review"]/android.widget.FrameLayout[1]')
    more_locator = (By.XPATH,'//*[@resource-id="com.xiachufang:id/common_control_panel_more_btn"]')
    share_locator = (By.XPATH,'//*[@text="分享作品"]')
    text_locator = (By.XPATH,'//*[@resource-id="com.xiachufang:id/tv_share_title"]')

    def click_picture(self):
        self.find_element(self.picture_locator).click() #点击作品内的图片
    def click_more(self):
        self.find_element(self.more_locator).click() #点击右上角三个点
    def click_share(self):
        self.find_element(self.share_locator).click() #点击分享作品
    def get_text(self):
        current_text = self.find_element(self.text_locator).get_attribute('text') #获取文本
        return current_text